<{if empty($info['seller_id'])}>
<form id="add_link" action='<{link app="verification" ctl="admin_sellers" act="add"}>' method="POST" class="tableform">
<{else /}>
<form id="add_link" action='<{link app="verification" ctl="admin_sellers" act="edit"}>' method="POST" class="tableform">
<{/if}>
    <div class="division">
        <table width="100%" border="0" cellpadding="0" cellspacing="0" >
        <{if empty($info['seller_id'])}>
            <tr>
                <th><em class="red">*</em>商户编号：</th>
                <td>
                	<{input type='text' name='seller_id' id="seller_id" value=$info.seller_id|default:'' vtype='required' required='true' size=30}>(15位，不允许修改)
                </td>
            </tr>
            <{else/}>
            <tr>
                <th><em class="red">*</em>商户编号：</th>
                <td>
                    <{input type='text' name='seller_id' id="seller_id" value=$info.seller_id|default:'' vtype='required' readonly="readonly" required='true' size=30}>(15位，不允许修改)
                </td>
            </tr>
            <{/if}>
            <tr>
                <th><em class="red">*</em>商户全称：</th>
                <td>
                	<{input type="text" name="seller_name" id="seller_name" value=$info.seller_name|default:'' vtype="required" required="true" size=30}>
                </td>
            </tr>
            <tr>
                <th><em class="red">*</em>简称：</th>
                <td>
                    <{input type="text" name="shortname" id="shortname" value=$info.shortname|default:'' vtype="required" required="true" size=30}>
                </td>
            </tr>
            <tr>
                <th>排序：</th>
                <td>
                    <{input type="text" name="sort" id="sort" value=$info.sort|default:1 vtype="required" required="true" size=5}>
                </td>
            </tr>
        </table>
    </div>
    <{if !empty($info['seller_id'])}>
        <input type="hidden" value="<{$info.seller_id}>" name="seller_id" />
    <{/if}>
    <div class="table-action">
        <{button type='button' label=$___a='保存'|t:'verification' onclick="sub_form(event);" }>
    </div>
</form>

<script>

function sub_form(event) {
    var $seller_id = ($('seller_id').get('value')).trim();
    var $sort = parseInt($('sort').get('value'));

    if( $seller_id.length != 15 || isNaN($seller_id)){
        alert('错误：商户号必须是15位数字');
        return false;
    }

    if(isNaN($sort) || $sort>99999){

        alert('错误：排序必须为不超过5位的数字');
        return false;
    }
    
    $('add_link').fireEvent('submit',new Event(event));
}

$('add_link').store('target',{
    onComplete:function($data){
        $data = eval("("+$data+')');
        if($data.success){
            $('add_link').getParent('.dialog').retrieve('instance').close();
        }
    }
});
</script>